package com.glory.brepda.adapter;

import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.brepda.R;
import com.glory.brepda.activity.mfg.ParaInfoCheckActivity;
import com.glory.brepda.activity.recipe.RecipeParaInfoQueryActivity;
import com.glory.brepda.base.MyApp;
import com.glory.brepda.entity.RecipeInfoEntity;
import com.glory.brepda.entity.RecipeParaInfoEntity;
import com.glory.brepda.entity.TempRecipeEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_LogUtils;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

import java.util.List;

public class RecipeInfoAdapter extends BaseQuickAdapter<RecipeParaInfoEntity.RECIPELISTBean, BaseViewHolder> {
    private boolean mStatus = true;
    public RecipeInfoAdapter(@Nullable List<RecipeParaInfoEntity.RECIPELISTBean> data, boolean status) {
        super(R.layout.item_bin_info_list,data);
        this.mStatus = status;
    }
    @Override
    protected void convert(BaseViewHolder helper, RecipeParaInfoEntity.RECIPELISTBean item) {
        helper.setText(R.id.list_tv1, item.getEQPID());
        helper.setText(R.id.list_tv2, item.getEQPTYPE());
        helper.setText(R.id.list_tv3, item.getRECIPENAME());
        helper.setText(R.id.list_tv4, item.getSTATUS());
        helper.setGone(R.id.list_tv4, true);
        helper.getView(R.id.llItemLayout).setOnClickListener(view -> {
            //判断是否可点击
            if (mStatus)
                return;
            Bundle bundle = new Bundle();
            bundle.putSerializable("PARAINFO", item);


            FreeApi_LogUtils.saveErrorMessages(item.toString(), "PARAINFO");

            FreeApi_Utils.skipWithExtraIntent("header", bundle, mContext, RecipeParaInfoQueryActivity.class);

        });
    }
}